@echo off
setlocal enabledelayedexpansion

set "sourceFolder=C:\Users\HP\IdeaProjects\java-design-patterns"
set "targetEncoding=UTF-8"

for /r "%sourceFolder%" %%f in (*.java) do (
    chcp 65001 > nul
    type "%%f" > "%%f.tmp"
    move /Y "%%f.tmp" "%%f"
)

echo Files in %sourceFolder% and its subfolders have been converted to %targetEncoding% encoding.

endlocal
